'''
pandas可以读取与存取的资料格式有很多种，像csv、excel、json、html与pickle等
'''
import pandas as pd
import pymysql

sql = 'select * from student'
con = pymysql.connect(host='localhost', user='root', password='2940053asd',
                      database='hy', charset='utf8', use_unicode=True)
df = pd.read_sql(sql, con)
print(df)
df.to_csv('student.csv')
# 读取csv
data = pd.read_csv('student.csv')
# 打印出data
print(data)
data.to_pickle('student.pickle')
df = pd.read_pickle('student.pickle')
df.to_excel('student.xls', sheet_name='data')
